package com.example.origin.mongo.controller;

import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
public class DemoController {

    @Resource
    private MongoTemplate mongoTemplate;


    @GetMapping("test")
    public String test(){
        Map<String,String> map = new HashMap<>();
        map.put("111","111");
        map.put("222","222");
        mongoTemplate.insert(map,"test");
        return "";
    }

}
